import 'package:fijkplayer/fijkplayer.dart';
import 'package:flu_framework/common/widgets/my_app_bar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';


class VideoPlayPage extends StatefulWidget {
  const VideoPlayPage({Key? key}) : super(key: key);

  @override
  State<VideoPlayPage> createState() => _VideoPlayPageState();
}

class _VideoPlayPageState extends State<VideoPlayPage> {
  String videoUrl = 'https://jbstatic.xue.com/courseVideo%2F%E9%AB%98%E8%80%83%E8%B5%A2%E5%9C%A8%E9%80%BB%E8%BE%91%2F01.mp4';
  String title = '';
  final FijkPlayer player = FijkPlayer();
  @override
  void initState() {
    super.initState();
    title = Get.arguments['title'];
    // videoUrl = Get.arguments['videoUrl'];
    player.setDataSource(videoUrl,autoPlay: true);
    player.enterFullScreen();
  }

  @override
  void dispose() {
    super.dispose();
    player.release();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MyAppBar(
        title: title,
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: FijkView(
            player: player,
        ),
      ),
    );
  }
}
